#!/bin/bash

source /mnt/flask_ruoyi_prod/venv/bin/activate

# 从配置文件中读取端口和工作进程数
source ./config.cfg

# 设置环境变量
export FLASK_CONFIG=$ENV_NAME
echo "使用环境：$ENV_NAME"

# 启动Gunicorn服务
#gunicorn app:app -w $WORKERS -b 0.0.0.0:$PORT &
gunicorn app:app -w $WORKERS -b 0.0.0.0:$PORT --access-logfile access.log --error-logfile error.log > >(tee -a output.log) 2>&1 &

echo "Gunicorn服务已启动，端口：$PORT，工作进程数：$WORKERS"
